import request from '@/utils/request'

const api = {
    // 根据ID获取缺陷类型
    getInfo(id)
    {
        return request({
            url: `/api/BaseData/Defect/${id}`,
            method: 'get'
        });
    },
    // 获取所有缺陷类型信息
    getAll()
    {
        return request({
            url: `/api/BaseData/Defect/All`,
            method: 'GET'
        });
    },
    // 查询缺陷类型信息
    getList(query)
    {
        return request({
            url: `/api/BaseData/Defect`,
            method: 'get',
            data: query
        });
    },
    // 创建缺陷类型
    create(dataForm)
    {
        return request({
            url: `/api/BaseData/Defect`,
            method: 'post',
            data: dataForm,
        });
    },
    // 更新缺陷类型
    update(dataForm)
    {
        return request({
            url: `/api/BaseData/Defect/${dataForm.id}`,
            method: 'put',
            data: dataForm,
        });
    },
    // 删除缺陷类型
    delete(id)
    {
        return request({
            url: `/api/BaseData/Defect/${id}`,
            method: 'delete',
        });
    },
    // 根据ID批量删除缺陷类型
    batchDelete(ids)
    {
        return request({
            url: `/api/BaseData/Defect/batchRemove`,
            method: 'POST',
            data: ids,
        });
    },
    // 根据查询条件导出数据
    export(query)
    {
        return request({
            url: `/api/BaseData/Defect/Actions/Export`,
            method: 'get',
            data: query
        });
    },
    // 导入
    ImportData(data)
    {
        return request({
            url: '/api/BaseData/Defect/ImportData',
            method: 'post',
            data
        });
    },
    // 导入预览
    ImportPreview(data)
    {
        return request({
            url: '/api/BaseData/Defect/ImportPreview',
            method: 'get',
            data
        });
    },
    // 模板下载
    TemplateDownload()
    {
        return request({
            url: '/api/BaseData/Defect/TemplateDownload',
            method: 'get'
        });
    }
};

export default api;

export const getDefactAll = api.getAll;
